// 系统相关的状态管理

const state = {
  wgtInfo: {},
  userCount: 25986, // 基础用户数量值
  userId: '100001', // 用户ID
  userPhone: '', // 用户手机号
};

const mutations = {
  SET_INFO: (state, info) => {
    state.wgtInfo = info
  },
  SET_USER_COUNT: (state, count) => {
    state.userCount = count
  },
  SET_USER_ID: (state, id) => {
    state.userId = id
  },
  SET_USER_PHONE: (state, phone) => {
    state.userPhone = phone
  }
};

const actions = {
  setWgtInfo({commit}, info) {
    commit('SET_INFO', info)
  },
  setUserCount({commit}, count) {
    commit('SET_USER_COUNT', count)
  },
  setUserId({commit}, id) {
    commit('SET_USER_ID', id)
  },
  setUserPhone({commit}, phone) {
    commit('SET_USER_PHONE', phone)
  },
};

const getters = {
  wgtInfo: (state) => {
    return state.wgtInfo || {}
  },
  userCount: (state) => {
    return state.userCount
  },
  userId: (state) => {
    return state.userId
  },
  userPhone: (state) => {
    return state.userPhone
  }
};

export default {
  namespaced: true,
  state,
  mutations,
  actions,
  getters
}
